package main

import (
	"encoding/json"
	"ego/entity"
	"fmt"
)

//json解析
// {"servers":[{"serverName":"Shanghai_VPN","serverIP":"127.0.0.1"},{"serverName":"Beijing_VPN","serverIP":"127.0.0.2"}]}
func main() {
	var s entity.Servers
	str:=`{"servers":[{"serverName":"Shanghai_VPN","serverIP":"127.0.0.1"},{"serverName":"Beijing_VPN","serverIP":"127.0.0.2"}]}`
	err:= json.Unmarshal([]byte(str),&s)
	if err !=nil{
		 fmt.Println("json 解析错误",err)
	}else {
		servers:=s.Servers
		for _,ser:=range servers {
			ser.ServerString()
		}
	}
}


